package com.ycu.jk16.mall.dao.provider;

import static com.ycu.jk16.mall.util.common.AndroidMalConstant.PRODUCT_PHOTO_TABLE;

import org.apache.ibatis.jdbc.SQL;

import com.ycu.jk16.mall.domain.ProductPhoto;

public class ProductPhotoDynaSqlProvider {
	public String insertProductPhoto(ProductPhoto photo) {
		return new SQL() {
			{
				INSERT_INTO(PRODUCT_PHOTO_TABLE);
				// VALUES("数据库字段", "#{java属性名}");
				if (photo.getId() != null && !photo.getSubImage().equals("")) {
					VALUES("product_id", "#{id}");
				}
				if (photo.getSubImage() != null && !photo.getSubImage().equals("")) {
					VALUES("subimage", "#{subImage}");
				}

			}
		}.toString();
	}
}
